package com.kabuda.controller;

import com.kabuda.domain.Category;
import com.kabuda.service.CategoryService;
import com.kabuda.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author kabuda
 * @create 2023-10-15 10:54
 */
@Api(tags = "分类Api")
@RestController
@RequestMapping("category")
public class CategoryController {

    private CategoryService categoryService;

    @Autowired
    public void setCategoryService(CategoryService categoryService) {
        this.categoryService = categoryService;
    }

    @ApiOperation("返回所有分类选项")
    @GetMapping("list")
    public R list(){
        List<Category> list = categoryService.list();
        return R.success("list",list);
    }
}
